- /* sdfsplit.cpp by K.Tsuru */
- // function ID = 3800 ver. 2.18
- /*********************************************************************
- It splits a SDouble value X in the form of rational number series
-
- X = u_0 + u_1/v + u_2/v^2 + u_3/v^4 + u_4/v^8 + ... + u_p/v^(2^{p-1}).
-
- where v = S_BASE. It returns 'p'.
- **********************************************************************/
-
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- int SplitSDouble(const SDouble& X, SNBlock <SLFraction>& slr, const SLong& V) {
- uint f = howpow2(X.EffFig() + X.Hidden());
- slr.reserve(f);
- SLong u, v(V);
- SDouble x(X);
- int k = 0;
-
- u = x; // integer part of x
- x -= u;
- slr[k].num = u; slr[k].den.SetShort(1); k++;
-
- x *= v; u = x; x -= u;
- slr[k].num = u; slr[k].den = v; k++;
-
- for( ; x.Sign() ; k++) {
- x *= v; u = x; x -= u; v *= v;
- slr.reserve(k);
- slr[k].num = u; slr[k].den = v;
- }
- return k;
- }
sdfsplit.cpp : last modifiled at 2007/04/21 16:02:28(924 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).